﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FrienDev.Data;
using FrienDev.BusinessRules;

public partial class Controls_Club_NavigatorBar : System.Web.UI.UserControl
{
    private bool m_IsAdmin=false;
    protected void Page_Load(object sender, EventArgs e)
    {
        
        int clubid = -1;
        if (HttpContext.Current.Request["clubId"] != null)
        {
            clubid = Convert.ToInt32(HttpContext.Current.Request["clubId"]);
        }
        if (clubid != -1)
        {
            if(!ClubRules.Instance.GetIsAdminOfClubByUserIdAndClubId(clubid,UserRules.Instance.GetCurrentUserId()))
            {
                this.pn_Admin.Visible=false;
            }
            postLink.NavigateUrl = "~/club/post.aspx" + "?clubid=" + clubid;
            memberLink.NavigateUrl = "~/club/MemberListDetail.aspx" + "?clubid=" + clubid;
            detailLink.NavigateUrl = "~/club/detail.aspx" + "?clubid=" + clubid;
            hy_Manage.NavigateUrl = "~/club/InfoEdit.aspx" + "?clubid=" + clubid;
            this.hy_Invite.NavigateUrl = "~/club/Invite.aspx" + "?clubId=" + clubid;

      }
        this.hy_Activity.NavigateUrl = "/Club/activitylist.aspx?clubId=" + clubid;
    }
    public static bool GetIsAdmin(int clubid)
    {
       return ClubRules.Instance.GetIsAdminOfClubByUserIdAndClubId(clubid, UserRules.Instance.GetCurrentUserId());
 
    }
}
